var express = require('express');

let multer = require('multer');
var upload = multer({ dest: './public/images/' }).single('file');
var msg = require('../utils/message');
var ctr = require("../controller/index");
var router = express.Router();

const email = require("../utils/email")
/* GET users listing. */

router.get('/list', upload, function (req, res, next) {
  ctr.getUserById(req, res).then((data) => {
    res.json(msg(true, data, '请求成功'))
  });
});

router.post('/test', upload, function (req, res, next) {
  ctr.uploadpostimg(req, res);
});

//注册
router.get('/insert', function (req, res, next) {
  res.json({ title: "ihao" })
});


router.get('/email', function (req, res, next) {
  let em = email(req.query.email||'');
  console.log(req.query.email)
  // console.log(em);
  // em.then((res)=>{
  //   console.log('1',res)
  // })
  res.json({ title: "ihao" })
});

module.exports = router;
